package cn.li.security.sms;

import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

/**
 * 短信登录必须实现这个借口
 */
public interface ISmsUserDetailService {

    /**
     * 按照电话加载用户信息
     * @param phone
     * @return
     * @throws UsernameNotFoundException
     */
    UserDetails loadUserByPhone(String phone) throws UsernameNotFoundException;


    /**
     * 校验短信验证码是否正确
     * @param phone
     * @param verifyCode
     * @throws BadCredentialsException
     */
    boolean testVerifyCode(String phone, String verifyCode) ;
}
